package com.api.shopapi.mapper;

import com.api.shopapi.entity.MedicationSchedulingNight;
import com.api.shopapi.entity.dto.MedicationSchedulingNightDTO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface MedicationSchedulingNightMapper {

    @Insert("insert into  medication_scheduling_night " +
            "(MedicationSchedulingNightCode,MedicationSchedulingCode) " +
            "values (#{medicationSchedulingNight.MedicationSchedulingNightCode} ,#{medicationSchedulingNight.medicationSchedulingCode} )")
    int insert(@Param("medicationSchedulingNight") MedicationSchedulingNight medicationSchedulingNight);

    @Update("update medication_scheduling_night set MedicationSchedulingCode=#{medicationSchedulingNight.MedicationSchedulingCode} where MedicationSchedulingNightCode=#{medicationSchedulingNight.MedicationSchedulingNightCode}   ")
    int updateByMedicationSchedulingNightCode(@Param("medicationSchedulingNight") MedicationSchedulingNight medicationSchedulingNight);

    @Delete("delete from medication_scheduling_night where MedicationSchedulingNightCode=#{medicationSchedulingNightCode} ")
    int deleteByMedicationSchedulingNightCode(@Param("medicationSchedulingNightCode")String medicationSchedulingNightCode);

    @Select("select * from medication_scheduling_night where MedicationSchedulingNightCode=#{medicationSchedulingNightCode} limit 1")
    MedicationSchedulingNight getByMedicationSchedulingNightCode(@Param("medicationSchedulingNightCode")String medicationSchedulingNightCode);

    @Select("select * from medication_scheduling_night where medicationSchedulingCode=#{medicationSchedulingCode} limit 1")
    MedicationSchedulingNightDTO getByMedicationSchedulingCode(@Param("medicationSchedulingCode") String medicationSchedulingCode);
}
